<template>
  <div>
    <Table :loading="loading" :columns="columns" :data="listData">
      <template slot-scope="{ index }" slot="detail">
        <Button
          type="primary"
          size="small"
          style="margin-right: 5px"
          @click="show_detail(index)"
        >查看详情</Button>
      </template>
    </Table>

    <Modal v-model="isDetail" title="日志详情" :footer-hide="true" :width="60">
      <pre>{{log_data}}</pre>
    </Modal>
  </div>
</template>

<script>
import { jsonForma } from '@/libs/util'

export default {
  name: 'logFrm',
  components: {

  },
  props: {
    pageNum: Number,
    loading: Boolean,
    listData: Array
  },
  data () {
    return {
      isDetail: false,
      log_data: '',
      columns: [
        {
          title: '日志编号',
          key: 'log_id',
          align: 'center',
          width: '85'
        },
        {
          title: '操作人员',
          align: 'center',
          key: 'manage_name'
        },
        {
          title: '操作名称',
          align: 'center',
          key: 'log_type'
        },
        {
          title: '操作IP',
          align: 'center',
          key: 'create_ip'
        },
        {
          title: '操作时间',
          align: 'center',
          key: 'create_time'
        },
        {
          title: '操作详情',
          align: 'center',
          slot: 'detail'
        }
      ]
    }
  },
  methods: {
    show_detail (index) {
      this.log_data = jsonForma(this.listData[index].log_data)
      this.isDetail = true
    }
  }
}
</script>

<style>

</style>
